function bgk_scaleup
%
% Rescales BGK solution to double number of modes.
%

fname_in='test_bgk.dfu.0001.00', jz=32;  jv=256; fname_out='test_bgk_2x.dfu.0000.00'

%---------------------------------------------------------

  fid = fopen(fname_in, 'rb');
  dfu = fread(fid, jv*jz, 'double');
  fclose(fid);

  dfu = reshape(dfu, jv,jz);  fmax_in = max(max(abs(dfu)))

  ff1  =  ifftn(dfu);
  ff2  =  zeros(2*jv,2*jz);
  ff2(jv/2+1:jv/2+jv, jz/2+1:jz/2+jz) = ifftshift(ff1);
  ff2  = fftshift(ff2);

  dfu = real(fftn(ff2));  fmax_out = max(max(abs(dfu)))


  % figure(1); imagesc(flipud(log(abs(fftshift(ff2)))), [log(1.e-19), log(1e-3)]);
  % figure(2); imagesc(flipud(dfu), [-0.01,0.01] );   axis('equal', 'tics', 'off');


  fid = fopen(fname_out, 'wb');
  fwrite(fid, dfu, 'double');
  fclose(fid);

 %---------------------------------------------------------

end
